Contents | Index | < Browse | Browse >

LETTERfloorULETTER Get the floor of a real number.

Overview
#include <math.h>

x = floor(y);

double x, y;

Portability
ANSI

Description
"floor" returns the largest integer not greater than the specified real number (to be preciesly, the largest number <= "y"). The result will however still be a "double" and no integer value.

Returns
The floor will be returned as a double-precision floating-point number.

See also
ceil

Example
#include <stdio.h>
#include <math.h>

void main(void)
{
double r;

r = floor(147.73); // r contains 147.0
printf("floor(147.73 = %lf\n", r);
}